import request from '@/utils/request'

// Get tree structure data
export function getScreenConfigTree() {
  return request({
    url: '/screen/bottom/map/tree',
    method: 'get'
  })
}

// Add or update screen config
export function addOrUpdateScreenConfig(data: any) {
  return request({
    url: '/screen/bottom/map/addOrUpdate',
    method: 'post',
    data
  })
}

// Delete screen config
export function deleteScreenConfig(data: any) {
  return request({
    url: '/screen/bottom/map/delete',
    method: 'delete',
    params: data
  })
}

// Move screen config item
export function moveScreenConfig(data: any) {
  return request({
    url: '/screen/bottom/map/move',
    method: 'get',
    params: data
  })
}

// Get area list
export function getAreaList() {
  return request({
    url: '/resource/area/query',
    method: 'get'
  })
}

// Get area relation config
export function getAreaRelation(areaId: string) {
  return request({
    url: '/screen/bottom/map/relation',
    method: 'get',
    params: { areaId }
  })
}

// Update area relation
export function updateAreaRelation(data: any) {
  return request({
    url: '/screen/bottom/map/update/area',
    method: 'post',
    data
  })
}